//
//  RootDataListTableViewCell.m
//  VTravel
//
//  Created by lanouhn on 16/8/2.
//  Copyright © 2016年 xiaoYu. All rights reserved.
//

#import "RootDataListTableViewCell.h"
/** 邮轮model */
#import "RootShipModel.h"

@implementation RootDataListTableViewCell

/** 懒加载 */
- (void)setShipModel:(RootShipModel *)shipModel{
    NSString *urlString = [NSString stringWithFormat:@"/%@", shipModel.thumb];
    [self.rootListImageView sd_setImageWithURL:[NSURL URLWithString:ImageURL(urlString)]];
    self.rootListTitleLabel.text = shipModel.product_name;
    self.rootListDetailLabel.text = [NSString stringWithFormat:@"[%@出发]", shipModel.port_name];
    self.rootListPriceLabel.text = StrByAppendStr(@"¥", shipModel.min_price);
}
- (void)setTicketModel:(RootTicketModel *)ticketModel{
    // image对应的value数据类型有时候是数组,有时候是字符串,我们需要做一下判断
    if ([ticketModel.images[@"image"] isKindOfClass:[NSArray class]]) {
        [self.rootListImageView sd_setImageWithURL:[NSURL URLWithString:ticketModel.images[@"image"][0]]];
    }else if ([ticketModel.images[@"image"] isKindOfClass:[NSString class]]){
        [self.rootListImageView sd_setImageWithURL:[NSURL URLWithString:ticketModel.images[@"image"]]];
    }
    self.rootListTitleLabel.text = ticketModel.product_name;
    if (ticketModel.place_level.length != 0) {
        self.rootListDetailLabel.text = [NSString stringWithFormat:@"景区级别%@", ticketModel.place_level];
    }else{
        self.rootListDetailLabel.text = nil;
    }
    self.rootListPriceLabel.text = StrByAppendStr(@"¥", ticketModel.start_price);
}
- (void)setStudayModel:(RootStudyModel *)studayModel{
    [self.rootListImageView sd_setImageWithURL:[NSURL URLWithString:ImageURL(StrByAppendStr(@"/upload/thumb/%@", studayModel.thumb))]];
    self.rootListTitleLabel.text = studayModel.name;
    self.rootListPriceLabel.text = [NSString stringWithFormat:@"¥%@", studayModel.camper_price];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
